﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chaos.messages
{
    class process_start_game : message
    {
        public override void process(context in_context)
        {
            ProcessStartGameEvent e = new ProcessStartGameEvent();
            System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal,
                new OnProcessStartGameDelegate(OnProcessStartGameUIThread), e);
        }

        public override void serialize(stream.stream in_Stream)
        {
            in_Stream.begin("process_start_game")
            .end();
        }


        public class ProcessStartGameEvent : EventArgs
        {
            public ProcessStartGameEvent()
            {
            }
        };
        public delegate void OnProcessStartGameDelegate(ProcessStartGameEvent e);

        public void OnProcessStartGameUIThread(ProcessStartGameEvent e)
        {
            commands.showscreen c = System.Windows.Application.Current.FindResource("command_showscreen") as commands.showscreen;
            if (c != null)
            {
                c.Execute("GameScreen");
            }
        }

    }
}
